﻿#region
/*******************************************************************************
** File Name:		    AdminUserRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using EWineShop.Entity;
using EWineShop.Respository;
using IBatisNet.DataMapper;
using JCode.Data.IBatis;
using System.Collections;

namespace EWineShop.IBatisRepository
{
    public class AdminUserRepository : RepositoryBase<EAdminUser>, IAdminUser
    {
    
		#region  Auto Generation

        //public string SqlMapConfigUri { private get; set; }

        public AdminUserRepository(string sqlMapConfigUri)
            : base(sqlMapConfigUri)
        {
            //base.SqlMapConfigUri = this.SqlMapConfigUri;
        }
        		
        public void AddAdminUser(EAdminUser entity)
        {
			string stmtId = "AdminUserMap.InsertAdminUser";
			base.SqlMapper.Insert(stmtId, entity);
        }
        
		public  EAdminUser GetByUserID (System.Int64 userID)
        {
			
            return SelectByPk(userID);
        }
        
        public  void DeleteByUserID (System.Int64 userID)
        {
			//string stmtId = "AdminUserMap.DeleteByUserID";
			//base.SqlMapper.Update(stmtId, userID);
           
            throw new Exception("aaaaaaaaaaaaa");
            Delete(userID);
        }
        
        public  void UpdateByUserID (EAdminUser entity)
        {
			string stmtId = "AdminUserMap.UpdateByUserID";
			base.SqlMapper.Update(stmtId, entity);
        }


		public  IList<EAdminUser> GetAll ()
        {
			string stmtId = "AdminUserMap.SelectAll";
			return base.SqlMapper.QueryForList<EAdminUser>(stmtId,null);
        }

		#endregion



        public EAdminUser GetByUserName(string UserName)
        {
            string stmtId = "AdminUserMap.SelectByUserName";
            return base.SqlMapper.QueryForObject<EAdminUser>(stmtId, UserName);
            
        }
    }
}

